<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>Home</h1>
<script>
    // TODO 采坑记录，如果是跨域请求，每次 JSESSIONID 都在变，需要配置 {credentials: 'include'}
    fetch(`http://${location.host}/login`, {
        method: 'POST',
        credentials: 'include',
        headers: {'Content-Type': 'application/json;charset=utf-8'},
        body: JSON.stringify({json: {username: 'admin', password: 'admin'}})
    }).then((res) => res.json()).then(json => {
        console.log(json);
    });
</script>
</body>
</html>